import React, { ReactElement } from 'react'
import css from '../assets/styles/header.less'
import { Menu, Dropdown, message } from 'antd';
import { DownOutlined } from '@ant-design/icons';
import { history} from 'umi'
interface Props {

}

export default function MyHeader({ }: Props): ReactElement {
  
    function onClick() {
        console.log("这是首页");

    }
    const goLogin=()=>{
        history.push('/login')
    }
    const menu = (
        <Menu onClick={onClick}>
            <Menu.Item key="1">
                首页
            </Menu.Item>
            <Menu.Item key="2" onClick={goLogin}>退出</Menu.Item>
        </Menu>
    )
    return (
        <div className={css.header}>
            <div className={css.userInfo}>
                <img src={require('../assets/images/default.jpg').default} alt="" />
                <Dropdown overlay={menu}>
                    <a className="ant-dropdown-link" onClick={e => e.preventDefault()} href="!#">
                        欢迎登陆 <DownOutlined />
                    </a>
                </Dropdown>
            </div>
        </div>
    )
}
